package com.chengyu.stock.mapper;

import com.chengyu.stock.pojo.domain.Stock4EvrDayDomain;
import com.chengyu.stock.pojo.domain.Stock4EvrWeekDomain;
import com.chengyu.stock.pojo.domain.Stock4MinuteDomain;
import com.chengyu.stock.pojo.domain.StockUpdownDomain;
import com.chengyu.stock.pojo.entity.StockRtInfo;
import org.apache.ibatis.annotations.Param;
import org.joda.time.DateTime;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
* @author CY
* @description 针对表【stock_rt_info(个股详情信息表)】的数据库操作Mapper
* @createDate 2022-12-13 21:42:27
* @Entity com.chengyu.stock.pojo.entity.StockRtInfo
*/
public interface StockRtInfoMapper {

    int deleteByPrimaryKey(Long id);

    int insert(StockRtInfo record);

    int insertSelective(StockRtInfo record);

    StockRtInfo selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(StockRtInfo record);

    int updateByPrimaryKey(StockRtInfo record);

    List<StockUpdownDomain> getStockPageInfo(@Param("curDate") Date curDate);


    List<Map> getStockUpdownCount(@Param("openTime") Date openTime, @Param("curTime") Date curTime, @Param("flag") int flag);

    List<Map> getLastDate4Stock(@Param("curDateTime") Date curDateTime);


    List<Stock4MinuteDomain> getStockScreenTimeSharing(@Param("code") String code, @Param("curDate") Date curDate, @Param("openDate") Date openDate);

    List<Stock4EvrDayDomain> getStockScreenEvrDaySharing(@Param("code") String code, @Param("startTime") Date startTime, @Param("endTime") Date endTime);

    //批量保存个股数据
    int insertBatch(@Param("stockRtInfos") List<StockRtInfo> list);

    /**
     * 查询股票每周的基础数据，包含每周的开盘时间点和收盘时间点
     * 但是不包含开盘价格和收盘价格
     * @param stockCode 股票编码
     * @param startTime 开始时间
     * @param endTime 结束时间
     * @return
     */
    List<Stock4EvrWeekDomain> getHalfWeekLineData(@Param("stockCode") String stockCode,
                                                  @Param("startTime") Date startTime,
                                                  @Param("endTime") Date endTime);

    /**
     * 查询指定股票在指定时间下的数据
     * @param stockCode
     * @param times
     * @return
     *  map接口：
     *      openPrice:xxx
     *      closePrice:xxx
     */
    List<BigDecimal> getStockInfoByCodeAndTimes(@Param("stockCode") String stockCode,
                                                @Param("times") List<Date> times);

}
